<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%--
  Created by IntelliJ IDEA.
  User: 烽
  Date: 2015/7/17
  Time: 0:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div id="menu" class="col-md-10 col-md-offset-1">
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">&nbsp;</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li class="
                    <c:if test="${flag == \"index\"}">
                      active
                    </c:if>
                  "><a href="<%=request.getContextPath()%>/index/index">主页 <span class="sr-only">(current)</span></a>
                    </li>

                    <li class="dropdown
                        <c:if test="${flag == \"blog\"}">
                          active
                        </c:if>">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                           aria-haspopup="true" aria-expanded="false">博客 <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="<%=request.getContextPath()%>/blog/allBlog?pageNum=1">所有</a></li>
                            <%--<li><a href="#">最热门</a></li>--%>
                            <%--<li><a href="#">分类</a></li>--%>
                            <%--<li role="separator" class="divider"></li>--%>
                            <%--<li><a href="#">所有</a></li>--%>

                            <%--<li><a href="#">转载</a></li>--%>
                        </ul>
                    </li>

                    <li class="
                    <c:if test="${flag == \"contact\"}">
                      active
                    </c:if>"><a href="<%=request.getContextPath()%>/contact/contact">联系我</a></li>
                    <security:authorize access="not hasRole('ROLE_ADMIN')">
                        <li><a href="<%=request.getContextPath()%>/login">登录</a></li>
                    </security:authorize>
                    <security:authorize access="hasRole('ROLE_ADMIN')">
                        <li class="dropdown
                        <c:if test="${flag == \"manage\"}">
                          active
                        </c:if>">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                               aria-haspopup="true" aria-expanded="false">管理<span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="<%=request.getContextPath()%>/blogManage/addBlog">新增文章</a></li>
                                <li><a href="<%=request.getContextPath()%>/blogManage/all">分类管理</a> </li>
                                <li role="separator" class="divider"></li>
                                <li><a href="/spring3-security-integration/auth/login">退出</a></li>
                            </ul>
                        </li>

                    </security:authorize>

                </ul>

                <form class="navbar-form navbar-right" role="search">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="全站搜索">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>
</div>
